package com.example.li.controller;

import com.example.li.model.Lawyer;
import com.example.li.model.User;
import com.example.li.service.LawyerService;
import com.example.li.util.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/lawyer")
public class LawyerController {
    @Autowired

            LawyerService lawyerService;
    //登录
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public ResultDTO login(@RequestBody Lawyer lawyer) {
        return lawyerService.login(lawyer);
    }

    //注册
    @RequestMapping(value = "/lawyerRegister", method = RequestMethod.POST)
    public ResultDTO lawyerRegister(@RequestBody Lawyer lawyer) {
        return lawyerService.lawyerRegister(lawyer);
    }

    //查询律师列表
    @RequestMapping(value = "/getLawyerList", method = RequestMethod.POST)
    public ResultDTO getLawyerList(@RequestBody Lawyer lawyer) {
        return new ResultDTO().success(lawyerService.getLawyerList(lawyer));
    }
    //    通过id显示律师信息
    @RequestMapping(value = "/showLawyer",method = RequestMethod.POST)
    public ResultDTO showLawyer(@RequestBody Lawyer lawyer){
        return lawyerService.showLawyer(lawyer);
    }

    //    修改律师信息
    @RequestMapping(value = "/updateLawyer", method = RequestMethod.POST)
    public ResultDTO updateLayer(@RequestBody Lawyer lawyer) {
        return lawyerService.updateLawyer(lawyer);
    }

    //删除
    @RequestMapping(value = "/deleteLawyer", method = RequestMethod.POST)
    public ResultDTO deleteLawyer(@RequestBody Lawyer lawyer) {
        return lawyerService.deleteLawyer(lawyer);
    }
}
